def select_coin(coin_value, total_value):
    min_coin_num = [0]
    for i in range(1, total_value + 1):
        min_coin_num.append(float('inf'))
        for value in coin_value:
            #value是硬币的面值
            #如果面值比当前要凑的钱数小，比如用value=3元凑i=6元
            #那么就判断，加上当前value面值的硬币是否比现在的更小
            if value <= i and min_coin_num[i - value] + 1 < min_coin_num[i]:
                min_coin_num[i] = min_coin_num[i - value] + 1
    return min_coin_num

result = select_coin([1, 3, 5], 6)
print("coin number:" + str(result[-1]))